<template>
  <div class="menu">
    <el-menu default-active="/home" class="el-menu-vertical-demo" background-color="#222d32" text-color="#cddde9"
      active-text-color="#fff" :unique-opened="true" :router="true">

      <el-menu-item index="/home">
        <i class="el-icon-s-home"></i>
        <span slot="title">系统首页</span>
      </el-menu-item>

      <el-submenu index="1">
        <template slot="title">
          <i class="el-icon-s-custom"></i>
          <span>人员管理</span>
        </template>
        <el-menu-item index="/account" v-if="role ==2">账号管理</el-menu-item>
        <el-menu-item index="/updatePassword">修改密码</el-menu-item>
      </el-submenu>
      <el-submenu index="2">
        <template slot="title">
          <i class="el-icon-s-goods"></i>
          <span>基础配置</span>
        </template>
        <el-menu-item index="/ranch">牧场管理</el-menu-item>
        <el-menu-item index="/colonyHouse">圈舍管理</el-menu-item>
      </el-submenu>


    </el-menu>
  </div>
</template>
  
<script>
export default {
  data() {
    return {
      role: ''
    }
  },
  created() {
    let user = JSON.parse(localStorage.getItem('user'))
    this.role = user.role
  }
};
</script>
  
<style lang="less" scoped>
.menu {
  width: 200px;
  overflow: hidden;
  height: 100%;
  background: #222d32;
}

.el-menu {
  border-right: none;
}
</style>